.TH E1432_SET_SOURCE_MODE 3 E1432
.SH NAME
.nf
e1432_set_source_mode \- Set source mode
e1432_get_source_mode \- Get current state of source mode
.fi
.IX e1432_set_source_mode(3) 3
.IX e1432_get_source_mode(3) 3
.SH SYNOPSIS
.cS
SHORTSIZ16 e1432_set_source_mode(E1432ID hw, SHORTSIZ16 ID,
                                 SHORTSIZ16 mode)
SHORTSIZ16 e1432_get_source_mode(E1432ID hw, SHORTSIZ16 ID,
                                 SHORTSIZ16 *mode)
.cE
.SH DESCRIPTION
\fIe1432_set_source_mode\fR sets the source mode, of a single channel
or group of channels \fIID\fR, to the value given in \fImode\fR.

\fIe1432_get_source_mode\fR returns the current value of the source
mode, of a single channel or group of channels \fIID\fR, into a memory
location pointed to by \fImode\fR.

\fIhw\fR must be the result of a successful call to
\fIe1432_assign_channel_numbers\fR, and specifies the group of
hardware to talk to.

\fIID\fR is either the ID of a group of channels that was obtained with a
call to \fIe1432_create_channel_group\fR, or the ID of a single channel.

\fImode\fR determines the source mode.  The valid values are
\fBE1432_SOURCE_MODE_SINE\fR for sine mode,
\fBE1432_SOURCE_MODE_BSINE\fR for burst sine mode,
\fBE1432_SOURCE_MODE_RAND\fR for random noise,
\fBE1432_SOURCE_MODE_BRAND\fR for burst random noise,
\fBE1432_SOURCE_MODE_RANDZ\fR for zoomed random noise,
\fBE1432_SOURCE_MODE_BRANDZ\fR for zoomed burst random noise, and
\fBE1432_SOURCE_MODE_ARB\fR for an arbitrary signal.
\fBE1432_SOURCE_MODE_BARB\fR for a burst arbitrary signal.

For \fBE1432_SOURCE_MODE_RANDZ\fR or \fBE1432_SOURCE_MODE_BRANDZ\fR
the noise is digitally mixed (multiplied) by a complex sine wave.  The
frequency of the sine wave is set by \fIe1432_set_source_centerfreq\fR
or \fIe1432_set_center_freq\fR.  This results in a source signal with
a spectrum that is centered around the frequency set by this function
with a span set by \fIe1432_set_span\fR function or
\fIe1432_set_source_span\fR.

There are limitations on the spans available in the zoomed modes,
since these modes require more than twice as many digital filter
operations to create.  The top frequency is limited to one fifth of
the normal top frequency for the module; i.e. if the normal frequency
is 20Khz, the top frequency in zoom is limited to 4KHz. The center
frequency is constrained to be below this top frequency limit.

For \fBE1432_SOURCE_MODE_ARB\fR and \fBE1432_SOURCE_MODE_BARB\fR, the
host program must provide the data to use for the arbitrary signal, by
using the \fIe1432_write_srcbuffer_data\fR function.  The arb data
must be reloaded into the buffers after setting which source channels
are active.

For \fBE1432_SOURCE_MODE_BARB\fR, the source buffer mode must be set
to \fBE1432_SRCBUFFER_PERIODIC_A\fR or
\fBE1432_SRCBUFFER_PERIODIC_AB\fR.

For all of the burst modes, multiple source channels will burst at
exactly the same time regardless of what form of triggering is used by
the system.

For non-burst modes, an auto-triggered measurement will start the
source at the system sync, so that it is already on by the time the
inputs start taking data (though ramp-up may not yet be complete,
depending on the ramp rate set by \fIe1432_set_ramp_rate\fR).  In
contrast, a non-auto-triggered measurement will start the source at
the first trigger.

For random signal modes, \fBE1432_SOURCE_MODE_RAND\fR,
\fBE1432_SOURCE_MODE_BRAND\fR, \fBE1432_SOURCE_MODE_RANDZ\fR, and
\fBE1432_SOURCE_MODE_BRANDZ\fR, the nearly normal
amplitude distribution results in occassional high peak amplitudes.  To
avoid clipping, etc., the actual random noise level is much less than the 
source level set using \fIe1432_set_amp_scale\fR and \fIe1432_set_range\fR.

Typical source levels for non burst random signals when \fIamp_scale\fR set
to 1 are:

.nf
source mode                             Vrms/Vrange     Vpeak/Vrms

base-band random top span               0.22            3.2
base-band random other spans            0.2             4.4
zoomed random                           0.11            4.4

.fi
Burst random signal levels will be similar, during the burst on time.

There is no "off" source mode.  To turn a source channel off, make it
inactive using e1432_set_active.

When the source is off, it is normally low impedance to ground.  To
make the source high impedance, use the \fIe1432_set_source_output\fR
function, with the \fBE1432_SOURCE_OUTPUT_OPEN\fR parameter.

There are currently some realtime restrictions that vary depending on
the source mode used, whether parameters are changed during a
measurement, and which source outputs are being used.  Currently the
conditions that will produce realtime source errors have been locked
out by the following logic and will produce
\fBERR1432_SRC_REALTIME_RESTRICTION\fR errors if violated:

.nf
   Lockouts for clock_freq:

	Daughter board:
   	if ((ARB_CONT or ARB_PER_A or ARB_ONESHOT) and decimation) and
        (clock_freq > 64000))

	For SCA with 2 channels active:
      	if ((RANDZ or BRANDZ or ARB_CONT or ARB_PER_A or ARB_ONESHOT) and
         (clock_freq > 51200))

   Lockouts for changing parameters during a measurement:

	Daughter Board:
	if ((BSINE and clock_freq > 64000) or
	((BRAND or RANDZ or BRANDZ or ARB (with decimation)) and
	(clock_freq > 51200)))

	SCA with 2 channels active:
	if ((BSINE and clock_freq > 64000) or
	((RAND(with decimation) or ARB) and clock_freq > 51200) or
	((BRAND or RANSZ or BRANDZ ) and (clock_freq > 50000)))


	SCA with 1 channel active:
	if ((BSINE or BRAND or BRANDZ) and (freq >64000))

.fi

Obviously, this function is not useful when talking to input or tach
channels.  Only source channels have a source mode.
.SH "RESET VALUE"
After a reset, \fImode\fR is set to \fBE1432_SOURCE_MODE_SINE\fR.
.SH "RETURN VALUE"
Return 0 if successful, a (negative) error number otherwise.
.SH "SEE ALSO"
.na
e1432_set_amp_scale, e1432_set_range, e1432_set_input_mode,
e1432_set_active, e1432_set_source_output, e1432_set_source_span,
e1432_set_source_centerfreq, e1432_set_srcbuffer_mode
.ad
